<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var n = 0;
        function repeat(func,num,times){
            var key = setInterval(function(){
            func('执行次数'+ ++n);
            if(n>=num){
                clearInterval(key);
            }
            },times);
        }
        repeat(console.log,6,3000);
        


    </script>
</body>
</html>